package com.cmsky.open.user.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import com.cmsky.open.core.base.*;
import com.cmsky.open.core.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.cmsky.open.user.model.*;
import com.cmsky.open.user.dao.*;
import com.cmsky.open.user.manager.*;
import com.cmsky.open.user.vo.query.*;

/**
 * @author jandyfish email:jandyfish(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


public class UserInfo extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "UserInfo";
	public static final String ALIAS_ID = "编号";
	public static final String ALIAS_NICK = "用户昵称";
	public static final String ALIAS_NAME = "姓名";
	public static final String ALIAS_CARD_ID = "身份证号码";
	public static final String ALIAS_CARD_SEQ = "身份证序列号";
	public static final String ALIAS_PASSWD = "密码";
	public static final String ALIAS_EMAIL = "邮箱";
	public static final String ALIAS_PHONE = "手机号码";
	public static final String ALIAS_MONEY = "账户余额";
	public static final String ALIAS_REGIST_TIME = "注册时间";
	public static final String ALIAS_CONFIG_TIME = "认证时间";
	public static final String ALIAS_STATE = "用户状态";
	
	//date formats
	public static final String FORMAT_REGIST_TIME = DATE_FORMAT;
	public static final String FORMAT_CONFIG_TIME = DATE_FORMAT;
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 编号       db_column: id 
     */	
	
	private java.lang.Integer id;
    /**
     * 用户昵称       db_column: nick 
     */	
	@NotBlank @Length(max=20)
	private java.lang.String nick;
    /**
     * 姓名       db_column: name 
     */	
	@Length(max=20)
	private java.lang.String name;
    /**
     * 身份证号码       db_column: card_id 
     */	
	@Length(max=20)
	private java.lang.String cardId;
    /**
     * 身份证序列号       db_column: card_seq 
     */	
	@Length(max=20)
	private java.lang.String cardSeq;
    /**
     * 密码       db_column: passwd 
     */	
	@Length(max=20)
	private java.lang.String passwd;
    /**
     * 邮箱       db_column: email 
     */	
	@Email @Length(max=50)
	private java.lang.String email;
    /**
     * 手机号码       db_column: phone 
     */	
	@Length(max=15)
	private java.lang.String phone;
    /**
     * 账户余额       db_column: money 
     */	
	
	private java.lang.Float money;
    /**
     * 注册时间       db_column: regist_time 
     */	
	
	private java.util.Date registTime;
    /**
     * 认证时间       db_column: config_time 
     */	
	
	private java.util.Date configTime;
    /**
     * 用户状态       db_column: state 
     */	
	
	private java.lang.Integer state;
	//columns END

	public UserInfo(){
	}

	public UserInfo(
		java.lang.Integer id
	){
		this.id = id;
	}

	public void setId(java.lang.Integer value) {
		this.id = value;
	}
	
	public java.lang.Integer getId() {
		return this.id;
	}
	public void setNick(java.lang.String value) {
		this.nick = value;
	}
	
	public java.lang.String getNick() {
		return this.nick;
	}
	public void setName(java.lang.String value) {
		this.name = value;
	}
	
	public java.lang.String getName() {
		return this.name;
	}
	public void setCardId(java.lang.String value) {
		this.cardId = value;
	}
	
	public java.lang.String getCardId() {
		return this.cardId;
	}
	public void setCardSeq(java.lang.String value) {
		this.cardSeq = value;
	}
	
	public java.lang.String getCardSeq() {
		return this.cardSeq;
	}
	public void setPasswd(java.lang.String value) {
		this.passwd = value;
	}
	
	public java.lang.String getPasswd() {
		return this.passwd;
	}
	public void setEmail(java.lang.String value) {
		this.email = value;
	}
	
	public java.lang.String getEmail() {
		return this.email;
	}
	public void setPhone(java.lang.String value) {
		this.phone = value;
	}
	
	public java.lang.String getPhone() {
		return this.phone;
	}
	public void setMoney(java.lang.Float value) {
		this.money = value;
	}
	
	public java.lang.Float getMoney() {
		return this.money;
	}
	public String getRegistTimeString() {
		return DateConvertUtils.format(getRegistTime(), FORMAT_REGIST_TIME);
	}
	public void setRegistTimeString(String value) {
		setRegistTime(DateConvertUtils.parse(value, FORMAT_REGIST_TIME,java.util.Date.class));
	}
	
	public void setRegistTime(java.util.Date value) {
		this.registTime = value;
	}
	
	public java.util.Date getRegistTime() {
		return this.registTime;
	}
	public String getConfigTimeString() {
		return DateConvertUtils.format(getConfigTime(), FORMAT_CONFIG_TIME);
	}
	public void setConfigTimeString(String value) {
		setConfigTime(DateConvertUtils.parse(value, FORMAT_CONFIG_TIME,java.util.Date.class));
	}
	
	public void setConfigTime(java.util.Date value) {
		this.configTime = value;
	}
	
	public java.util.Date getConfigTime() {
		return this.configTime;
	}
	public void setState(java.lang.Integer value) {
		this.state = value;
	}
	
	public java.lang.Integer getState() {
		return this.state;
	}
	
	private Set userMoneyInfos = new HashSet(0);
	public void setUserMoneyInfos(Set<UserMoneyInfo> userMoneyInfo){
		this.userMoneyInfos = userMoneyInfo;
	}
	
	public Set<UserMoneyInfo> getUserMoneyInfos() {
		return userMoneyInfos;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Nick",getNick())
			.append("Name",getName())
			.append("CardId",getCardId())
			.append("CardSeq",getCardSeq())
			.append("Passwd",getPasswd())
			.append("Email",getEmail())
			.append("Phone",getPhone())
			.append("Money",getMoney())
			.append("RegistTime",getRegistTime())
			.append("ConfigTime",getConfigTime())
			.append("State",getState())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof UserInfo == false) return false;
		if(this == obj) return true;
		UserInfo other = (UserInfo)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.append(getNick(),other.getNick())
			.append(getName(),other.getName())
			.append(getCardId(),other.getCardId())
			.append(getCardSeq(),other.getCardSeq())
			.append(getPasswd(),other.getPasswd())
			.append(getEmail(),other.getEmail())
			.append(getPhone(),other.getPhone())
			.append(getMoney(),other.getMoney())
			.append(getRegistTime(),other.getRegistTime())
			.append(getConfigTime(),other.getConfigTime())
			.append(getState(),other.getState())
			.isEquals();
	}
}

